<?php
namespace Macaca\Model\Admin;

use Macaca\Model\Base;
use Monkey;

class Goods extends Base {

    public $table = 'goods'; //'g_id','gc_id','g_name','captain','detail','image','price','keywords','description','add_time','top_sort','click'
    public $priKey = 'g_id';

    public function findList($page = 0, $pageLength = 10) {
        return $this->conn->select($this->table, 'g')
            ->join('goods_category', 'gc', 'g.gc_id = gc.gc_id')
            ->fields('g_id', 'captain', 'price', 'g_name', 'top_sort', 'add_time', 'click')
            ->addFields('gc', array('caption' => 'gc_caption'))
            ->orderBy('g.g_id', 'DESC')
            ->range($pageLength, $page*$pageLength)
            ->execute()->fetchAll();

    }

}